%plotIRF_mcsim.m

function plotIRF_mcsim(varirf,modelirf,vars,nimp)

[nvars,temp]=size(vars);      
N = nvars;
R=round(N/2);

% Plot IRFs 
for n=1:N;
     subplotn = subplot(R,2,n);
     set(subplotn,'FontName','Times New Roman','FontSize',12,'Layer','top','YGrid','on');
                                    hold on;
                                    irf2 = plot(1:nimp,varirf(1:nimp,n,2),'b--','LineWidth',2);
                                    irf3 = plot(1:nimp,varirf(1:nimp,n,3),'r-.','LineWidth',2);
                                    irfm = plot(1:nimp,modelirf(1:nimp,n),'k-','LineWidth',2);                    
                                    plot(1:nimp,zeros(nimp),':k','LineWidth',1);
                                    grid on
                                    title(vars(n,:),'FontSize',14,'FontWeight','bold');
                                    ylabel('percent');
                                    xlabel('quarters');
                                    hold off;
end
legend([irfm,irf2,irf3],'Model','VAR Bandpass filtered','VAR Bi-weight filtered','Location','southeast')
    


